
/**
 * This class creates a movableShapes panel to put movable shapes into
 * 
 * @author Matthew Edwards 
 * @version 4-9-10
 */

// Homework 11 written by Matthew Edwards
// Collaboration Statement:
// I did not discuss this assignment with anyone.

//import java.awt.Point;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.*;

public class LoginGUI extends JPanel
{
    private String name;
    private String pass;
    String role;
    /**
     * 
     */
    int location = 0;
    
    private static final long serialVersionUID = -7639599828354057466L;
    private final JLabel lblNewLabel = new JLabel("UserId");
    private JTextField textField;
    private JTable table;
    private JTextField textField_1;
    private JComboBox comboBox;
    public LoginGUI() {
        this.setSize(new Dimension(1000,1000) );
        add(lblNewLabel);
        
        textField = new JTextField();
        add(textField);
        textField.setColumns(10);
        
        JLabel lblPassword = new JLabel("Password");
        add(lblPassword);
        
        textField_1 = new JTextField();
        add(textField_1);
        textField_1.setColumns(10);
        
        JButton btnLogin = new JButton("Login");
        btnLogin.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                name = textField.getText();
                pass = textField_1.getText();
                location = 1;
            }
        });
        add(btnLogin);
        
        comboBox = new JComboBox();
        add(comboBox);
        comboBox.insertItemAt("doctor", 0);
        comboBox.insertItemAt("nurse", 1);
        comboBox.insertItemAt("patient", 2);
        comboBox.insertItemAt("admin", 3);
        
        
        
        
        table = new JTable();
        add(table);
    }
    
  
    
    public void actionPerformed(ActionEvent e) {
        JComboBox cb = (JComboBox)e.getSource();
         role = (String)cb.getSelectedItem();
         
        
    }
    
    public String getRole(){
        role = (String)comboBox.getSelectedItem();
        return role;
    }
    
    public int getLoc(){
        return location;
    }
    public void reset(){
        location = 0;
    }
    public void setRole(String input)
    {
        role = input;
    }
    public void setLoc(int input)
    {
        location = input;
    }
    
    public String name()
    {
        return name;
    }
    public String pass()
    {
        return pass;
    }

    
            
}